<template>
   
  <div class="app-container">
    <el-card class="filter-container" shadow="never">
      <div>
        <i class="el-icon-search"></i>
        <span>筛选搜索</span>
        <el-button
          style="float: right"
          @click="searchMemberList()"
          type="primary"
          size="small"
        >
          查询结果
        </el-button>
        <el-button
          style="float: right; margin-right: 10px"
          @click="updateOrderInfo()"
          type="primary"
          size="small"
		  v-if="false"
        >
          同步订单统计
        </el-button>
        <!-- <el-button
          style="float: right"
          @click="updateOrderInfo()"
          type="primary"
          size="small"
        >
          发放优惠券
        </el-button> -->
      </div>
      <div style="margin-top: 15px">
        <el-form
          :inline="true"
          :model="listQuery"
          size="small"
          label-width="140px"
        >
          <el-form-item label="输入搜索：">
            <el-input
              style="width: 203px"
              v-model="listQuery.validatePhone"
              placeholder="请输入手机号"
              clearable
            ></el-input>
          </el-form-item>
          <el-form-item label="会员等级：">
            <el-select
              v-model="listQuery.level"
              placeholder="请选择会员等级"
              clearable
            >
              <el-option
                v-for="item in brandOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
    <el-card class="operate-container" shadow="never">
      <i class="el-icon-tickets"></i>
      <span>数据列表</span>
    </el-card>
    <div class="table-container">
      <el-table
        ref="brandTable"
        :data="list"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        v-loading="listLoading"
        border
      >
        <el-table-column
          type="selection"
          width="60"
          align="center"
        ></el-table-column>
        <el-table-column label="编号" width="60" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <el-table-column
          label="推荐人"
          width="140"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <p>{{ scope.row.inviteName }}</p>
            <!-- <p>{{ scope.row.invitecode }}</p>
            <p>{{ scope.row.job }}</p> -->
          </template>
        </el-table-column>

        <el-table-column
          label="用户昵称"
          width="140"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">{{ scope.row.nickname }}</template>
        </el-table-column>
        <el-table-column
          label="微信openID"
          width="140"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">{{ scope.row.weixinOpenid }}</template>
        </el-table-column>
        <el-table-column label="头像" width="120" align="center">
          <template slot-scope="scope"
            ><img style="height: 80px" :src="scope.row.icon"
          /></template>
        </el-table-column>
        <el-table-column label="电话号码" width="140" align="center">
          <template slot-scope="scope">{{ scope.row.phone }}</template>
        </el-table-column>
        <el-table-column label="验证手机号" width="140" align="center">
          <template slot-scope="scope">{{ scope.row.validatePhone }}</template>
        </el-table-column>
        <el-table-column label="邮箱" width="140" align="center">
          <template slot-scope="scope">{{ scope.row.email }}</template>
        </el-table-column>
        <el-table-column
          label="会员等级"
          width="140"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">L{{ scope.row.level }}</template>
        </el-table-column>
        <el-table-column
          label="用户余额"
          width="80"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <p>{{ scope.row.blance }}</p>
            <p>
              <el-button
                type="text"
                @click="handleShowVeriyEditDialog(scope.$index, scope.row)"
                >余额记录
              </el-button>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          label="用户积分"
          width="80"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <p>{{ scope.row.integration }}</p>
            <p>
              <el-button
                type="text"
                @click="handleShowIntegrationDialog(scope.$index, scope.row)"
                >积分记录
              </el-button>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          label="签到记录"
          width="80"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <!-- <p> {{scope.row.integration}}</p> -->
            <p>
              <el-button
                type="text"
                @click="handleSignList(scope.$index, scope.row)"
                >签到明细
              </el-button>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          label="邀请记录"
          width="80"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <!-- <p> {{scope.row.integration}}</p> -->
            <p>
              <el-button
                type="text"
                @click="handleInviteList(scope.$index, scope.row)"
                >邀请记录
              </el-button>
            </p>
          </template>
        </el-table-column>
        <!-- <el-table-column label="是否显示" width="70" align="center">
          <template slot-scope="scope">
            <el-switch
              @change="handleShowChange(scope.$index, scope.row)"
              :active-value="1"
              :inactive-value="0"
              v-model="scope.row.status">
            </el-switch>
          </template>
        </el-table-column> -->
        <!-- <el-table-column
          label="购买订单"
          width="80"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">{{ scope.row.buyCount }}</template>
        </el-table-column> -->
        <!-- <el-table-column
          label="消费金额"
          width="80"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">{{ scope.row.buyMoney }}</template>
        </el-table-column> -->
        <el-table-column
          label="注册时间"
          width="160"
          align="center"
          show-overflow-tooltip
        >
          <template slot-scope="scope">{{
            scope.row.createTime | formatTime
          }}</template>
        </el-table-column>
        <el-table-column label="操作" align="center" fixed="right" width="240">
          <template slot-scope="scope">
            <p>
              <el-button
                size="mini"
                type="danger"
                @click="addBlacne(scope.$index, scope.row, 2)"
                >余额
              </el-button>
              <el-button
                size="mini"
                type="success"
                @click="addBlacne(scope.$index, scope.row, 1)"
                >积分
              </el-button>
              <el-button
                size="mini"
                type="primary"
                @click="userOrder(scope.$index, scope.row)"
                >订单
              </el-button>
              <!-- <el-button
                            size="mini"
                            type="danger"
                            @click="handleDelete(scope.$index, scope.row)">删除
                          </el-button> -->
            </p>
            <p>
              <!-- <el-button
                      size="mini"
                      type="warning"
                      @click="addIntegration(scope.$index, scope.row)">标签
              </el-button> -->
              <!-- <el-button
                      size="mini"
                      type="danger"
                      @click="addIntegration(scope.$index, scope.row)">积分充值
              </el-button>
               <el-button
                                    size="mini"
                                    type="danger"
                                    @click="userOrder(scope.$index, scope.row)">订单
                            </el-button> -->
            </p>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="batch-operate-container"></div>
    <div class="pagination-container">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        layout="total, sizes,prev, pager, next,jumper"
        :page-size="listQuery.pageSize"
        :page-sizes="[10, 15, 50]"
        :current-page.sync="listQuery.pageNum"
        :total="total"
      >
      </el-pagination>
    </div>
    <el-dialog title="会员订单记录" :visible.sync="dialogVisible2" width="60%">
      <el-table
        style="width: 100%; margin-top: 20px"
        :data="orderList"
        border
        height="300"
      >
        <el-table-column label="编号" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <!-- <el-table-column label="订单编号" width="80" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column> -->
        <el-table-column label="商品" width="180" align="center">
          <template slot-scope="scope">{{ scope.row.goodsName }}</template>
        </el-table-column>
        <el-table-column label="下单时间" width="180" align="center">
          <template slot-scope="scope">{{
            scope.row.createTime | formatTime
          }}</template>
        </el-table-column>
        <el-table-column label="订单状态" width="80" align="center">
          <template slot-scope="scope">{{
            scope.row.status | formatOrderStatus
          }}</template>
        </el-table-column>
        <el-table-column label="订单金额" width="80" align="center">
          <template slot-scope="scope">￥{{ scope.row.payAmount }}</template>
        </el-table-column>
        <el-table-column label="支付方式" width="120" align="center">
          <template slot-scope="scope">
            
          <div v-if="scope.row.status==0 || scope.row.status==4"></div>
              <div v-else>{{scope.row.payType | formatPayType}}</div>
          </template>
        </el-table-column>
        <!-- <el-table-column label="订单来源" width="120" align="center">
                                          <template slot-scope="scope">{{scope.row.sourceType | formatSourceType}}</template>
                                        </el-table-column> -->
        <el-table-column label="订单类型" align="center">
          <template slot-scope="scope">{{
            scope.row.orderType | formatOrderType
          }}</template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <el-dialog
      title="签到明细"
      :visible.sync="dialogVisibleSign"
      width="40%"
      height="300"
    >
      <el-table
        style="width: 100%; margin-top: 20px"
        :data="integrationList"
        border
      >
        <el-table-column label="编号" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <el-table-column label="用户ID" align="center">
          <template slot-scope="scope">{{ scope.row.userId }}</template>
        </el-table-column>
        <el-table-column label="用户昵称" align="center">
          <template slot-scope="scope">{{ scope.row.nickName }}</template>
        </el-table-column>
        <el-table-column label="手机号" align="center">
          <template slot-scope="scope">{{ scope.row.validatePhone }}</template>
        </el-table-column>
        <el-table-column label="签到时间" align="center">
          <template slot-scope="scope">{{ scope.row.time }}</template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <el-dialog
      title="邀请记录"
      :visible.sync="dialogVisibleInvite"
      width="40%"
      height="300"
    >
      <el-table
        style="width: 100%; margin-top: 20px"
        :data="integrationList"
        border
      >
        <el-table-column label="编号" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <el-table-column label="被邀请人昵称" align="center">
          <template slot-scope="scope">{{ scope.row.nickName }}</template>
        </el-table-column>
        <el-table-column label="被邀请人电话" align="center">
          <template slot-scope="scope">{{ scope.row.validatePhone }}</template>
        </el-table-column>
        <!-- <el-table-column label="获得积分" align="center">
                                       <template slot-scope="scope">{{scope.row.score}}</template>
                                   </el-table-column> -->
        <el-table-column label="邀请时间" align="center">
          <template slot-scope="scope">{{ scope.row.createTime }}</template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <el-dialog title="积分记录" :visible.sync="dialogVisible1" width="40%">
      <el-table
        style="width: 100%; margin-top: 20px"
        :data="integrationList"
        border
        height="800"
      >
        <el-table-column label="编号" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <el-table-column label="用户编号" align="center">
          <template slot-scope="scope">{{ scope.row.userId }}</template>
        </el-table-column>
        <el-table-column label="名称" align="center">
          <template slot-scope="scope">{{ scope.row.name }}</template>
        </el-table-column>
        <el-table-column label="收入" align="center">
          <template slot-scope="scope">{{ scope.row.income }}</template>
        </el-table-column>
        <el-table-column label="支出" align="center">
          <template slot-scope="scope">{{ scope.row.pay }}</template>
        </el-table-column>
        <el-table-column label="创建时间" align="center">
          <template slot-scope="scope">{{ scope.row.time }}</template>
        </el-table-column>
      </el-table>
      <!-- <div class="pagination-container">
      <el-pagination
        background
        @size-change="handleSizeChange1"
        @current-change="handleCurrentChange1"
        layout="total, sizes,prev, pager, next,jumper"
        :page-size="listQuery1.pageSize"
        :page-sizes="[10,15,50]"
        :current-page.sync="listQuery1.pageNum"
        :total="total1"
      ></el-pagination>
    </div> -->
    </el-dialog>
    <el-dialog title="余额记录" :visible.sync="dialogVisible" width="40%">
      <el-table style="width: 100%; margin-top: 20px" :data="blanceList" border height="800">
        <el-table-column label="编号" align="center">
          <template slot-scope="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <el-table-column label="用户编号" align="center">
          <template slot-scope="scope">{{ scope.row.userId }}</template>
        </el-table-column>
        <el-table-column label="名称" align="center">
          <template slot-scope="scope">{{ scope.row.name }}</template>
        </el-table-column>
        <el-table-column label="收入" align="center">
          <template slot-scope="scope">{{ scope.row.income }}</template>
        </el-table-column>
        <el-table-column label="支出" align="center">
          <template slot-scope="scope">{{ scope.row.pay }}</template>
        </el-table-column>
        <el-table-column label="创建时间" align="center">
          <template slot-scope="scope">{{ scope.row.time }}</template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      :title="blanceType == 1 ? '积分充值' : '余额充值'"
      :visible.sync="blance.dialogVisible"
      width="40%"
    >
      <el-form :model="blance" ref="brandFrom" label-width="150px">
        <el-form-item
          :label="blanceType == 1 ? '充值积分' : '充值余额'"
          prop="detail"
        >
          <el-input v-model="blance.blance"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button @click="blance.dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="handleEditBlance">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      title="积分充值"
      :visible.sync="integration.dialogVisible"
      width="40%"
    >
      <el-form :model="integration" ref="brandFrom" label-width="150px">
        <el-form-item label="充值积分：" prop="detail">
          <el-input v-model="integration.integration"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button @click="integration.dialogVisible = false"
            >取 消</el-button
          >
          <el-button type="primary" @click="handleEditIntegration"
            >确 定</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
import { formatDate } from "@/utils/date";
import {
  fetchList,
  updateShowStatus,
  updateFactoryStatus,
  deleteMember,
  updateMemberOrderInfo,
  handleEditIntegration,
  handleEditBlance,
  getSignListApi,
  getInviteListApi,
} from "@/api/ums/member";
import { fetchList as fetchBlanceList } from "@/api/ums/memberBlanceLog";
import { fetchList as fetchIntegrationList } from "@/api/ums/memberIntegration";
import { fetchList as fetchMberLevelList } from "@/api/memberLevel";

import { fetchList as fetchOrderList } from "@/api/order";
export default {
  name: "memberList",
  data() {
    return {
      dialogVisibleSign: false,
      dialogVisibleInvite: false,
      blanceType: 1,
      dialogVisible: false,
      dialogVisible1: false,
      dialogVisible2: false,
      blanceList: null,
      integrationList: null,
      orderList: null,
      blance: {
        dialogVisible: false,
        id: null,
      },
      integration: {
        dialogVisible: false,
        id: null,
      },
      operates: [
        {
          label: "显示会员",
          value: "showMember",
        },
        {
          label: "隐藏会员",
          value: "hideMember",
        },
      ],
      operateType: null,
      brandOptions: [],
      listQuery: {
        validatePhone: null,
        pageNum: 1,
        pageSize: 10,
      },
      listQuery1: {
        pageNum: 1,
        pageSize: 10,
      },
      list: null,
      total: null,
      total1: null,
      listLoading: true,
      multipleSelection: [],
    };
  },
  created() {
    this.getList();
    this.geteMberLevelList();
  },
  filters: {
    formatPayType(value) {
      if (value === 1) {
        return "支付宝支付";
      } else if (value === 2) {
        return "微信支付";
      } else if (value === 3) {
        return "余额支付";
      } else if (value == 0) {
        return "未支付";
      } else if (value === 4) {
        return "积分支付";
      }
    },
    formatSourceType(value) {
      if (value === 1) {
        return "小程序";
      } else if (value === 2) {
        return "h5订单";
      } else if (value === 3) {
        return "PC订单";
      } else if (value === 4) {
        return "android订单";
      } else if (value === 5) {
        return "ios订单";
      }
    },
    formatOrderType(value) {
     if (value === 1) {
        return "普通订单";
      } else if (value === 2) {
        return "秒杀订单";
      } else if (value === 3) {
        return "拼团订单";
      } else if (value === 4) {
        return "积分订单";
      }
    },
    formatOrderStatus(value) {
      if (value == 0) {
        return "待付款";
      } else if (value == 1) {
        return "待发货";
      } else if (value == 2) {
        return "待收货";
      } else if (value == 3) {
        return "已完成";
      } else if (value == 4) {
        return "已关闭";
      } else if (value == 5) {
        return "待核销";
      }
    },
    formatTime(time) {
      if (time == null || time === "") {
        return "N/A";
      }
      let date = new Date(time);
      return formatDate(date, "yyyy-MM-dd hh:mm:ss");
    },
    verifyStatusFilter(value) {
      if (value === 1) {
        return "消费";
      } else {
        return "收入";
      }
    },
    formatchangeType(value) {
      if (value === 1) {
        return "增加";
      } else {
        return "减少";
      }
    },
    formatsourceType(value) {
      if (value === 1) {
        return "下单";
      }
      if (value === 2) {
        return "登录";
      } else {
        return "注册";
      }
    },
    formatStatus(value) {
      if (value === 1) {
        return "消费";
      }
      if (value === 2) {
        return "退款";
      }
      if (value === 3) {
        return "充值";
      }
      if (value === 4) {
        return "提现";
      }
      if (value === 5) {
        return "佣金";
      }
      if (value === 6) {
        return "平台调整";
      } else {
        return "收入";
      }
    },
    formatReturnAmount(row) {
      return row.productRealPrice * row.productCount;
    },
  },
  methods: {
    handleSignList(idx, row) {
      this.integrationList = [];
      this.dialogVisibleSign = true;
      this.getSignList(row);
    },
    handleInviteList(idx, row) {
      this.integrationList = [];
      this.dialogVisibleInvite = true;
      this.getInviteList(row);
    },
    // 邀请记录接口
    getInviteList(row) {
      console.log(row, 9999);
      getInviteListApi(row.id).then((res) => {
        this.integrationList = res.data.centerInviteRecordsList;
        console.log(res, 883921);
      });
    },
    // 签到明细接口
    getSignList(row) {
      console.log(row, 9999);
      getSignListApi({ userId: row.id }).then((res) => {
        this.integrationList = res.data;
        console.log(res, 883921);
      });
    },
    geteMberLevelList() {
      fetchMberLevelList({ pageNum: 1, pageSize: 1000 }).then((response) => {
        this.brandOptions = [];
        let brandList = response.data;
        for (let i = 0; i < brandList.length; i++) {
          this.brandOptions.push({
            label: brandList[i].level,
            value: brandList[i].id,
          });
        }
      });
    },
    addBlacne(index, row, type) {
      this.blance.dialogVisible = true;
      this.blance.id = row.id;
      this.blanceType = type;
    },
    addIntegration(index, row) {
      this.integration.dialogVisible = true;
      this.integration.id = row.id;
    },
    handleEditBlance() {
      if (this.blance.blance == null) {
        this.$message({
          message: "请输入余额",
          type: "warning",
          duration: 1000,
        });
        return;
      }
      this.$confirm("是否要进行充值", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        // let params = new URLSearchParams();
        // params.append('userId', this.blance.id);
        // params.append('type', this.blanceType);
        // params.append('money', this.blance.blance);
        // params.append('score', '');
        let params = {
          type: this.blanceType,
          userId: this.blance.id,
          money: 0,
          score: 0,
        };
        // 积分
        if (params.type == 1) {
          params.money = "";
          params.score = this.blance.blance;

        } else {
          params.score = "";
          params.money = this.blance.blance;
        }
        handleEditBlance(params).then((response) => {
          this.$message({
            message: "充值成功",
            type: "success",
            duration: 1000,
          });
          this.blance.blance=null
          this.getList();
        });
        this.blance.dialogVisible = false;
      });
    },
    handleEditIntegration() {
      if (this.integration.integration == null) {
        this.$message({
          message: "请输入积分",
          type: "warning",
          duration: 1000,
        });
        return;
      }
      this.$confirm("是否要进行积分充值", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        let params = new URLSearchParams();
        params.append("id", this.integration.id);
        params.append("integration", this.integration.integration);

        handleEditIntegration(params).then((response) => {
          this.$message({
            message: "积分充值成功",
            type: "success",
            duration: 1000,
          });
          this.getList();
        });
        this.integration.dialogVisible = false;
      });
    },
    handleShowVeriyEditDialog(index, row) {
      this.dialogVisible = true;
      //     fetchBlanceList({memberId:row.id,pageSize:1000}).then(response=>{
      //       this.blanceList=response.data.records;
      //    });
      fetchBlanceList({
        userId: row.id,
        type: 2,
        pageNum: 1,
        pageSize: 1000,
      }).then((response) => {
        this.blanceList = response.data.records;
      });
    },
    handleShowIntegrationDialog(index, row) {
      this.integrationList = [];
      this.dialogVisible1 = true;
      //   fetchIntegrationList({memberId:row.id,pageSize:1000}).then(response=>{
      //     this.integrationList=response.data.records;
      //  });
      fetchBlanceList({
        userId: row.id,
        type: 1,
        pageNum: 1,
        pageSize: 1000,
      }).then((response) => {
        this.integrationList = response.data.records;
        this.total1 = response.data.total;
        this.totalPage1 = response.data.pages;
        this.pageSize1 = response.data.size;
      });
    },
    userOrder(index, row) {
      this.dialogVisible2 = true;
      fetchOrderList({ memberId: row.id, pageSize: 1000 }).then((response) => {
        this.orderList = response.data.records;
      });
    },

    handleShowChange(index, row) {
      let params = new URLSearchParams();
      params.append("ids", row.id);
      params.append("showStatus", row.showStatus);
      updateShowStatus(params).then((response) => {
        this.$message({
          message: "修改成功",
          type: "success",
          duration: 1000,
        });
      });
    },
    getList() {
      this.listLoading = true;
      fetchList(this.listQuery).then((response) => {
        this.listLoading = false;
        this.list = response.data.records;
        this.total = response.data.total;
        this.totalPage = response.data.pages;
        this.pageSize = response.data.size;
      });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleUpdate(index, row) {
      this.$router.push({ path: "/ums/updateMember", query: { id: row.id } });
    },
    handleDelete(index, row) {
      this.$confirm("是否要删除该会员", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        deleteMember(row.id).then((response) => {
          this.$message({
            message: "删除成功",
            type: "success",
            duration: 1000,
          });
          this.getList();
        });
      });
    },
    getProductList(index, row) {
      console.log(index, row);
    },
    getProductCommentList(index, row) {
      console.log(index, row);
    },
    handleFactoryStatusChange(index, row) {
      var data = new URLSearchParams();
      data.append("ids", row.id);
      data.append("factoryStatus", row.factoryStatus);
      updateFactoryStatus(data)
        .then((response) => {
          this.$message({
            message: "修改成功",
            type: "success",
            duration: 1000,
          });
        })
        .catch((error) => {
          if (row.factoryStatus === 0) {
            row.factoryStatus = 1;
          } else {
            row.factoryStatus = 0;
          }
        });
    },
    handleShowStatusChange(index, row) {
      let data = new URLSearchParams();
      data.append("ids", row.id);
      data.append("showStatus", row.showStatus);
      updateShowStatus(data)
        .then((response) => {
          this.$message({
            message: "修改成功",
            type: "success",
            duration: 1000,
          });
        })
        .catch((error) => {
          if (row.showStatus === 0) {
            row.showStatus = 1;
          } else {
            row.showStatus = 0;
          }
        });
    },
    handleSizeChange(val) {
      this.listQuery.pageNum = 1;
      this.listQuery.pageSize = val;
      this.getList();
    },
    handleCurrentChange1(val) {
      this.listQuery1.pageNum = val;
      this.getList();
    },
    handleSizeChange1(val) {
      this.listQuery1.pageNum = 1;
      this.listQuery1.pageSize = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.listQuery.pageNum = val;
      this.getList();
    },
    searchMemberList() {
      this.listQuery.pageNum = 1;
      this.getList();
    },
    updateOrderInfo() {
      updateMemberOrderInfo().then((response) => {
        this.getList();
        this.$message({
          message: "同步成功",
          type: "success",
          duration: 1000,
        });
      });
    },
    handleBatchOperate() {
      console.log(this.multipleSelection);
      if (this.multipleSelection < 1) {
        this.$message({
          message: "请选择一条记录",
          type: "warning",
          duration: 1000,
        });
        return;
      }
      let showStatus = 0;
      if (this.operateType === "showMember") {
        showStatus = 1;
      } else if (this.operateType === "hideMember") {
        showStatus = 0;
      } else {
        this.$message({
          message: "请选择批量操作类型",
          type: "warning",
          duration: 1000,
        });
        return;
      }
      let ids = [];
      for (let i = 0; i < this.multipleSelection.length; i++) {
        ids.push(this.multipleSelection[i].id);
      }
      let data = new URLSearchParams();
      data.append("ids", ids);
      data.append("showStatus", showStatus);
      updateShowStatus(data).then((response) => {
        this.getList();
        this.$message({
          message: "修改成功",
          type: "success",
          duration: 1000,
        });
      });
    },
    addMember() {
      this.$router.push({ path: "/pms/addMember" });
    },
  },
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>


